<script lang="ts" setup>
import { ref, onMounted } from 'vue'
const inputRef = ref<HTMLInputElement | null>()
onMounted(() => {
  // es6中的可选链操作符
  inputRef.value?.focus()
})
</script>

<template>
  <div class="">
    <input type="text" ref="inputRef" />
  </div>
</template>

<style scoped></style>
